(use-package auctex)
(use-package auto-complete-auctex)
(use-package cdlatex)

(setq TeX-auto-save t)
(setq TeX-parse-self t)

;; 编译多个文件
;; https://tex.stackexchange.com/questions/111379/compilation-of-main-tex-file-from-a-chapter-file-with-auctex
(setq-default TeX-master "master")
;; 使用 xelatex 编译 tex 文件
(setq-default TeX-engine 'xetex)

(add-hook 'LaTeX-mode-hook 'auto-fill-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)

(setq reftex-plug-into-AUCTeX t)

;; 指定 SumatraPDF 来查看 pdf 档
(setq TeX-view-program-list '(("SumatraPDF" "SumatraPDF %o")))
(setq TeX-view-program-selection '((output-pdf "SumatraPDF")))

(provide 'init-tex)
